wayland: Simplify logic deciding whether to use xdg_popup
authorJonas Ådahl <jadahl@gmail.com>
Sun, 16 Feb 2020 15:42:52 +0000 (16:42 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Wed, 19 Feb 2020 08:47:18 +0000 (09:47 +0100)
From a handful of hueristics and guess-work, to a single
`surface->surface_type == GDK_SURFACE_POPUP`.

gdk/wayland/gdksurface-wayland.c

index 267943799e89f44eecd13ea0e3f7d44ddb257fe1..d9302c75e8b1dda1d3f47e1056440e6b4575a9c8 100644 (file)
@@ -2356,42 +2356,7 @@ should_be_mapped (GdkSurface *surface)
 static gboolean
 should_map_as_popup (GdkSurface *surface)
 {
-  GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
-
-  if (GDK_SURFACE_TYPE (surface) == GDK_SURFACE_POPUP)
-    return TRUE;
-
-  /* Ideally, popup would be temp surfaces with a parent and grab */
-  if (GDK_SURFACE_TYPE (surface) == GDK_SURFACE_TEMP)
-    {
-      /* If a temp surface has a parent and a grab, we can use a popup */
-      if (impl->transient_for)
-        {
-          if (impl->grab_input_seat)
-            return TRUE;
-        }
-      else
-        g_message ("Surface %p is a temporary surface without parent, "
-                   "application will not be able to position it on screen.",
-                   surface);
-    }
-
-  /* Yet we need to keep the surface type hint tests for compatibility */
-  switch ((guint) impl->hint)
-    {
-    case GDK_SURFACE_TYPE_HINT_POPUP_MENU:
-    case GDK_SURFACE_TYPE_HINT_DROPDOWN_MENU:
-    case GDK_SURFACE_TYPE_HINT_COMBO:
-      return TRUE;
-
-    default:
-      break;
-    }
-
-  if (impl->has_layout_data)
-    return TRUE;
-
-  return FALSE;
+  return GDK_SURFACE_TYPE (surface) == GDK_SURFACE_POPUP;
 }
 
 static void